<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>11.jquery 显示隐藏</title>
  <style>
    .box{
      width: 200px;
      height: 200px;
      background-color: rgb(40, 8, 70);
    }
  </style>
</head>

<script src="js/jquery-1.12.4.min.js"></script>
<script>
$(function(){
  $('.btn1').click(function(){
    $('.box').show(1000,function(){
      alert('显示成功!!!');
    });
  });
  $('.btn2').click(function () {
    $('.box').hide(1000,function(){
      // 作用: 动画执行完毕之后调用
      alert('恭喜!隐藏成功!');
    });
  });
  $('.btn3').click(function () {
    $('.box').toggle(1000);
  });
});
</script>
<body>
  <button class="btn1">显示</button>
  <button class="btn2">隐藏</button>
  <button class="btn3">切换</button>

  <div class="box"></div>
</body>
</html>